

*Loading the data
clear
use "data_directed3.dta"

*panel structure
xtset dyadid year
label variable v2regsupgroupssize_min "Support group size (dyad)"
label variable cap_1 "CINC$_{i}$"
label variable cap_2 "CINC$_{j}$"
label variable contig "Contiguity"
label variable ldistance "L(distance)"
label variable c1_s_far_maddisonGDP "GDP$_{i}$"
label variable c2_s_far_maddisonGDP "GDP$_{j}$"
label variable c1_s_far_Maddison_pop_estimate "Pop$_{i}$"
label variable c2_s_far_Maddison_pop_estimate "Pop$_{j}$"
label variable v2x_polyarchy_min "Polyarchy (dyad)"
label variable polity_min "Democracy (polity) (dyad)"
label variable cwpceyrs "Peace years"
label variable cwpceyrs2 "Peace years$^{2}$"
label variable cwpceyrs3 "Peace years$^{3}$"
label variable v2regsupgroupssize_min "Support group size (dyad)"
label variable c1_business "Business elites $_{i}"
label variable c2_business "Business elites $_{j}"
label variable c1_business_a "Business elites $_{i}"
label variable c2_business_a "Business elites $_{j}"
label variable business_business_a "Business elites (dyad)"
label variable c1_business_r "Business elites share s$_{i}"
label variable c1_business_r "Business elites share s$_{i}"
label variable c2_business_r "Business elites share $_{j}"
label variable c1_urbmidclass "Urban middle class $_{i}"
label variable c1_urbmid_r "Urban middle class share $_{i}"
label variable c1_urbworkers "Industrial workers $_{i}"
label variable c1_urbworkers_r "Industrial workers share $_{i}"
label variable c1_military "Military $_{i}"
label variable c1_military_r "Military share $_{i}"
label variable c1_party "Party elites $_{i}"
label variable c1_party_r "Party elites share $_{i}"
label variable c2_party "Party elites $_{j}"
label variable c2_party_r "Party elites share$_{j}"
label variable party_party "Party elites dyad"
label variable party_party_ "Party elites share dyad"
label variable c1_urbmidclass_r "Urban middle class share $_{i}"
label variable c1_business_r "Business elites share s$_{i}"
label variable c2_business_r "Business elites share $_{j}"
label variable business_business "Business elites (dyad)"
label variable business_business_r "Business elites share (dyad)"
label variable cwpceyrs "Peace years"
label variable cwpceyrs "Peace years"
label variable cwpceyrs2 "Peace years$^{2}$"
label variable cwpceyrs3 "Peace years$^{3}$"
label variable v2regsupgroupssize_min "Support group size (dyad)"

label variable c1_business_one "Business elites $_{i}"
label variable c1_business_a "Business elites $_{i}"
label variable c1_business_imp "Business elites $_{i}"
label variable c2_business_one "Business elites $_{i}"
label variable c2_business_a "Business elites $_{j}"
label variable c2_business_imp "Business elites $_{i}"
label variable business_business_a "Business elites (dyad)"
label variable business_business_imp "Business elites (dyad)"
label variable business_business_one "Business elites (dyad)"

 
**********************************************************************************
***********        CAUSAL SENSITIVITY TESTS 1: BASELINE CONTROLS   ***************
**********************************************************************************

****RMAX=2xR2

*business i

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and double the r2 of the controlled model
bs r(beta), rep(100): psacalc beta c1_business, rmax(.04) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m1

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 5X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c1_business, rmax(.10) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m2

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 10X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c1_business, rmax(.20) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m3


*business j
*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and double the r2 of the controlled model
bs r(beta), rep(100): psacalc beta c2_business, rmax(.04) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m1b

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 5X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c2_business, rmax(.10) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m2b

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 10X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c2_business, rmax(.20) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m3b


*business (dyad)
*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and double the r2 of the controlled model
bs r(beta), rep(100): psacalc beta business_business, rmax(.04) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m1c

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 5X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta business_business, rmax(.10) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m2c

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 10X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta business_business, rmax(.20) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m3c


**********************************************************************************
***********        CAUSAL SENSITIVITY TESTS 2: ADDITIONAL CONTROLS   ***************
**********************************************************************************

regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3


****RMAX=2xR2

*business i

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and double the r2 of the controlled model
bs r(beta), rep(100): psacalc beta c1_business, rmax(.04) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m1

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 5X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c1_business, rmax(.10) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m2

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 10X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c1_business, rmax(.20) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m3


*business j
*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and double the r2 of the controlled model
bs r(beta), rep(100): psacalc beta c2_business, rmax(.04) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m1

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 5X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c2_business, rmax(.10) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m2

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 10X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c2_business, rmax(.20) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m3


*business (dyad)
*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and double the r2 of the controlled model
bs r(beta), rep(100): psacalc beta business_business, rmax(.04) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m1

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 5X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta business_business, rmax(.10) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m2

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 10X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta business_business, rmax(.20) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m3

*Predictions
logit cwinit c1_business c2_business business_business  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
quietly margins, at(c1_business=(0(1)1)) vce(unconditional)
marginsplot
quietly margins, at(business_business=(0(1)1)) vce(unconditional)
marginsplot

*DOES THE WHO MATTER CONDITIONAL ON TARGETS (DIRECTED DYADS)
clear
use "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Data\data_directed3.dta"

xtset dyadid year

label variable v2regsupgroupssize_min "Support group size (dyad)"
label variable cap_1 "CINC$_{i}$"
label variable cap_2 "CINC$_{j}$"
label variable contig "Contiguity"
label variable ldistance "L(distance)"
label variable c1_s_far_maddisonGDP "GDP$_{i}$"
label variable c2_s_far_maddisonGDP "GDP$_{j}$"
label variable c1_s_far_Maddison_pop_estimate "Pop$_{i}$"
label variable c2_s_far_Maddison_pop_estimate "Pop$_{j}$"
label variable v2x_polyarchy_min "Polyarchy (dyad)"
label variable polity_min "Democracy (polity) (dyad)"
label variable cwpceyrs "Peace years"
label variable cwpceyrs2 "Peace years$^{2}$"
label variable cwpceyrs3 "Peace years$^{3}$"
label variable v2regsupgroupssize_min "Support group size (dyad)"
label variable c1_business "Business elites $_{i}"
label variable c2_business "Business elites $_{j}"
label variable c1_business_a "Business elites $_{i}"
label variable c2_business_a "Business elites $_{j}"
label variable business_business_a "Business elites (dyad)"
label variable c1_business_r "Business elites share s$_{i}"
label variable c1_business_r "Business elites share s$_{i}"
label variable c2_business_r "Business elites share $_{j}"
label variable c1_urbmidclass "Urban middle class $_{i}"
label variable c1_urbmid_r "Urban middle class share $_{i}"
label variable c1_urbworkers "Industrial workers $_{i}"
label variable c1_urbworkers_r "Industrial workers share $_{i}"
label variable c1_military "Military $_{i}"
label variable c1_military_r "Military share $_{i}"
label variable c1_party "Party elites $_{i}"
label variable c1_party_r "Party elites share $_{i}"
label variable c2_party "Party elites $_{j}"
label variable c2_party_r "Party elites share$_{j}"
label variable party_party "Party elites dyad"
label variable party_party_ "Party elites share dyad"
label variable c1_urbmidclass_r "Urban middle class share $_{i}"
label variable c1_business_r "Business elites share s$_{i}"
label variable c2_business_r "Business elites share $_{j}"
label variable business_business "Business elites (dyad)"
label variable business_business_r "Business elites share (dyad)"
label variable cwpceyrs "Peace years"
label variable cwpceyrs "Peace years"
label variable cwpceyrs2 "Peace years$^{2}$"
label variable cwpceyrs3 "Peace years$^{3}$"
label variable v2regsupgroupssize_min "Support group size (dyad)"

label variable c1_business_one "Business elites $_{i}"
label variable c1_business_a "Business elites $_{i}"
label variable c1_business_imp "Business elites $_{i}"
label variable c2_business_one "Business elites $_{i}"
label variable c2_business_a "Business elites $_{j}"
label variable c2_business_imp "Business elites $_{i}"
label variable business_business_a "Business elites (dyad)"
label variable business_business_imp "Business elites (dyad)"
label variable business_business_one "Business elites (dyad)"

*FIGURE ONLY FOR COW

collapse c1_business, by(year)
twoway (line c1_business year, sort lcolor(red) lpattern(long)), yscale(range(0 1))  ylabel(0(.10)1) xline(1900) legend(region(lwidth(none))) graphregion(fcolor(white) ifcolor(white))  title("Business elites (COW countries))") ytitle("Share of countries with group in support coalition")  



*****************************************

***DESCRIPTIVES

*****************************************

eststo clear
 
estpost summarize cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 
esttab using "desc3.tex", cells("count mean sd min max") noobs label
 
*****************************************

***TABLE 1: BUSINESS ELITES

*****************************************


set more off

****MODELS WITH THE "PARTICIPATE" measure

*with farris controls
logit cwinit c1_business_a c2_business_a business_business_a c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m1


*with farris controls + polyarchy and supsize
logit cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m2

*relogit
relogit cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid)
estimates store m3

*fixed effects
xtreg cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.decade  , fe 
estimates store m4


****MODELS WITH THE relative measure

*with farris controls
logit cwinit c1_business_r c2_business_r business_business_r c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m5

*with farris controls + polyarchy and supsize
logit cwinit c1_business_r c2_business_r business_business_r v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m6

*relogit
relogit cwinit c1_business_r c2_business_r business_business_r v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3   , cluster(dyadid)
estimates store m7

*fixed effects
xtreg cwinit c1_business_r c2_business_r business_business_r v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.decade  , fe 
estimates store m8


esttab m1 m2 m3 m4 m5 m6 m7 m8 using "tab2.xls" , replace



esttab m1 m2 m3 m4 m5 m6 m7 m8 using "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\tables\tab2_v8.tex" ,   style(tex) nogaps compress mtitles label stats(N r2 regionFE decadeFE)

outreg2 using "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\tables\tab2_v9.rtf" 


**********************************************************************************
***********       MARGINAL EFFECTS BASELINE MODELS                 ***************
**********************************************************************************

*Predictions
logit cwinit c1_business_a c2_business_a business_business_a  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
margins, at(c1_business_a=(0(1)1)) vce(unconditional)

marginsplot

quietly margins, at(business_business_a=(0(1)1)) vce(unconditional)
marginsplot







**********************************************************************************
***********        CAUSAL SENSITIVITY TESTS 1: BASELINE CONTROLS   ***************
**********************************************************************************

****RMAX=2xR2

*business i

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and double the r2 of the controlled model
bs r(beta), rep(100): psacalc beta c1_business, rmax(.04) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m1

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 5X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c1_business, rmax(.10) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m2

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 10X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c1_business, rmax(.20) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m3


*business j
*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and double the r2 of the controlled model
bs r(beta), rep(100): psacalc beta c2_business, rmax(.04) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m1b

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 5X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c2_business, rmax(.10) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m2b

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 10X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c2_business, rmax(.20) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m3b


*business (dyad)
*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and double the r2 of the controlled model
bs r(beta), rep(100): psacalc beta business_business, rmax(.04) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m1c

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 5X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta business_business, rmax(.10) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m2c

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 10X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta business_business, rmax(.20) model(regress cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m3c


**********************************************************************************
***********        CAUSAL SENSITIVITY TESTS 2: ADDITIONAL CONTROLS   ***************
**********************************************************************************

regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3


****RMAX=2xR2

*business i

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and double the r2 of the controlled model
bs r(beta), rep(100): psacalc beta c1_business, rmax(.04) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m1

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 5X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c1_business, rmax(.10) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m2

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 10X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c1_business, rmax(.20) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m3


*business j
*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and double the r2 of the controlled model
bs r(beta), rep(100): psacalc beta c2_business, rmax(.04) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m1

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 5X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c2_business, rmax(.10) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m2

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 10X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta c2_business, rmax(.20) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m3


*business (dyad)
*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and double the r2 of the controlled model
bs r(beta), rep(100): psacalc beta business_business, rmax(.04) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m1

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 5X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta business_business, rmax(.10) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m2

*BASELINE CONTROLS: adjusted coefficient when unobservable selection is proportional to observables and 10X the R2 of the controlled model
bs r(beta), rep(100): psacalc beta business_business, rmax(.20) model(regress cwinit c1_business c2_business business_business c1_v2x_cspart c1_v2x_jucon c1_v2x_gender c1_v2strenadm c1_v2x_clphy c1_v2stfisccap c1_v2svstterr c2_v2x_cspart c2_v2x_jucon c2_v2x_gender c2_v2strenadm c2_v2x_clphy c2_v2stfisccap c2_v2svstterr v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate cap_1 cap_2 contig ldistance cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid))
estimates store m3

*Predictions
logit cwinit c1_business c2_business business_business  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
quietly margins, at(c1_business=(0(1)1)) vce(unconditional)
marginsplot
quietly margins, at(business_business=(0(1)1)) vce(unconditional)
marginsplot

*****************************************

***TABLE 2: CONDITIONAL RELATIONSHIPS

*****************************************


*log of total trade (smoothed)
gen ltradetot = log(smoothtotrade+0.0001)

*log of i imports from j
gen limports = log(smoothflow1+0.0001)
gen lexports = log(smoothflow2+0.0001)


summarize smoothtotrade, detail
*summary of trade
summarize ltradetot , detail
summarize smoothtotrade , detail
summarize smoothflow1 , detail
summarize smoothflow2 , detail
summarize limports , detail
summarize lexports , detail

****TABLE

*****TEMPORAL HETEROGENEITY (PRE VS: POST 1919)

*pre 1900
logit cwinit c1_business_r c2_business_r business_business_r v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  if year<1900 , cluster(dyadid)
estimates store m1

*1900-1950
logit cwinit c1_business_r c2_business_r business_business_r v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  if year>1899 & year<1951 , cluster(dyadid)
estimates store m2

*Post-1950
logit cwinit c1_business_r c2_business_r business_business_r v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  if year>1950 , cluster(dyadid)
estimates store m3

esttab  m1 m2 m3  using "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\tables\temporal.tex" , replace  style(tex) nogaps compress mtitles label stats(N r2)



****Validity tests

*creating new dummies
*04 threshold

gen c1_buis_04 = .
replace c1_buis_04 = 1 if c1_business_a > 0.39999
replace c1_buis_04 = 0 if c1_business_a < 0.4


gen c2_buis_04 = .
replace c2_buis_04 = 1 if c2_business_a > 0.39999
replace c2_buis_04 = 0 if c2_business_a < 0.4

gen business_dyad_04 =.
replace business_dyad_04 = 0
replace business_dyad_04 = 1 if c2_buis_04 == 1 & c1_buis_04 == 1

logit cwinit c1_buis_04 c2_buis_04 business_dyad_04 v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade , cluster(dyadid)
estimates store m1

*06 threshold
gen c1_buis_06 = .
replace c1_buis_06 = 1 if c1_business_a > 0.599999
replace c1_buis_06 = 0 if c1_business_a < 0.6

gen c2_buis_06 = .
replace c2_buis_06 = 1 if c2_business_a > 0.599999
replace c2_buis_06 = 0 if c2_business_a < 0.6

gen business_dyad_06 =.
replace business_dyad_06 = 0
replace business_dyad_06 = 1 if c2_buis_06 == 1 & c1_buis_06 == 1

logit cwinit c1_buis_06 c2_buis_06 business_dyad_06 v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade , cluster(dyadid)
estimates store m2

*WITH MORE THAN TWO CODERS
logit cwinit c1_business_r c2_business_r business_business_r  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if c1_v2regsupgroups_nr>2 & c2_v2regsupgroups_nr>2, cluster(dyadid) 
estimates store m3

esttab  m1 m2 m3  using"C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\tables\validity.tex" , replace  style(tex) nogaps compress mtitles label stats(N r2)

*****TRADE (split sample)

*above median trade
logit cwinit c1_business c2_business business_business v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if ltradetot>0.0004 , cluster(dyadid)
estimates store m3

*below median trade
logit cwinit c1_business c2_business business_business v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if ltradetot<0.0004 , cluster(dyadid)
estimates store m4

*******OTHER GROUPS
logit cwinit c1_business_r c2_business_r business_business_r c1_agrarian c1_aristorcracy c1_party   c1_bureaucrats c1_military  c1_ethnic c1_religious  c1_locals c1_urbworkers c1_urbmidclass c1_rurworkers c1_rurmidclass   v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade , cluster(dyadid)
estimates store m5

esttab  m1 m2 m3 m4 m5 using "C:\Users\torewig_adm\Dropbox\Samarbeid\HVDEM_WAR\tables\cond8.tex" , replace  style(tex) nogaps compress mtitles label stats(N r2)


****MODELS WITH THE "PARTICIPATE" measure

*with farris controls
logit cwinit c1_business_a c2_business_a business_business_a c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 ltradetot i.rlregion i.decade  , cluster(dyadid)
estimates store m1


*with farris controls + polyarchy and supsize
logit cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 ltradetot i.rlregion i.decade  , cluster(dyadid)
estimates store m2

*relogit
relogit cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 ltradetot , cluster(dyadid)
estimates store m3

*fixed effects
xtreg cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 ltradetot i.decade  , fe 
estimates store m4

esttab  m1 m2 m3 m4 using "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\tables\tradecontrol.tex" , replace  style(tex) nogaps compress mtitles label stats(N r2)


***********************SPLIT-SAMPLE TESTS PLOTS
set scheme s1color

*high vs. low trade - trade does not seem to matter much when controlling for other factors
logit cwinit ltradetot c1_business c2_business business_business v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if ltradetot>0.0004 , cluster(dyadid)
estimates store m4

*margins
margins, at(c1_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_c1_hightrade.pdf", replace as(pdf) name("Graph")

*above median trade
logit cwinit ltradetot c1_business c2_business business_business v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if ltradetot>0.0004 , cluster(dyadid)
estimates store m4

*Results above median trade
margins, at(c1_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_c1_hightrade.pdf", replace as(pdf) name("Graph")


margins, at(business_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_dyad_hightrade.pdf", replace as(pdf) name("Graph")


*below median trade
logit cwinit ltradetot c1_business c2_business business_business v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if ltradetot<0.0004 , cluster(dyadid)
estimates store m5

*Results below median trade
quietly margins, at(c1_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_c1_lowtrade.pdf", replace as(pdf) name("Graph")


margins, at(business_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_dyad_lowtrade.pdf", replace as(pdf) name("Graph")



*above median exports
logit cwinit c1_business c2_business business_business v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if lexports>1 , cluster(dyadid)
estimates store m6

*Results above median exports
quietly margins, at(c1_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_c1_highexports.pdf", replace as(pdf) name("Graph")


quietly margins, at(business_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_dyad_highexports.pdf", replace as(pdf) name("Graph")


*below median exports
logit cwinit c1_business c2_business business_business v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if lexports<1 , cluster(dyadid)
estimates store m7

*Results below median exports
quietly margins, at(c1_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_c1_lowexports.pdf", replace as(pdf) name("Graph")


quietly margins, at(business_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_dyad_lowexports.pdf", replace as(pdf) name("Graph")



*above median imports
logit cwinit c1_business c2_business business_business v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if limports>1 , cluster(dyadid)
estimates store m8

*Results above median imports
quietly margins, at(c1_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_c1_highimports.pdf", replace as(pdf) name("Graph")


quietly margins, at(business_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_dyad_highimports.pdf", replace as(pdf) name("Graph")



*below median imports
logit cwinit c1_business c2_business business_business v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if limports<1 , cluster(dyadid)
estimates store m9

*Results below median imports
quietly margins, at(c1_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_c1_lowimports.pdf", replace as(pdf) name("Graph")


quietly margins, at(business_business=(0(1)1)) vce(unconditional)
marginsplot, yscale(range(0 .005))  ylabel(.001(.001).005)
graph export "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Figures\Business_dyad_lowimports.pdf", replace as(pdf) name("Graph")



**********************************************************************
************            DIFFERENT TYPES OF MIDS   ********************
**********************************************************************

clear
use "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\Data\data_directed3_JCR.dta"


*territory
regress mid_territory c1_business_r c2_business_r business_business_r v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m1


*regime
regress mid_regime c1_business_r c2_business_r business_business_r v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m2

*policy
regress mid_policy c1_business_r c2_business_r business_business_r v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m3


*reciprocated
regress mid_recip c1_business_r c2_business_r business_business_r v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m4

*fatalities > 
regress mid_fatlev4 c1_business_r c2_business_r business_business_r v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m5

*fatalities >  
regress mid_fatlev5 c1_business_r c2_business_r business_business_r v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m6

*fatalities > 
regress mid_fatlev6 c1_business_r c2_business_r business_business_r v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m7

esttab m1 m2 m3 m4 m5 m6 m7 using "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\tables\mid_heterogeneitytable.tex" , replace  style(tex) nogaps compress mtitles label stats(N r2 regionFE decadeFE)


****************************************************
********** SEQUENTIALLY DROPPING CONTROLS   ********
****************************************************

*no polyarchy
logit cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.decade i.rlregion   
estimates store m1

*no GDP
logit cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min  c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.decade i.rlregion   
estimates store m2

*no pop
logit cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.decade i.rlregion   
estimates store m3

*no capabilities
logit cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.decade i.rlregion   
estimates store m4

*no contiguity
logit cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate ldistance cwpceyrs cwpceyrs2 cwpceyrs3 i.decade i.rlregion   
estimates store m5

*no distance
logit cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig  cwpceyrs cwpceyrs2 cwpceyrs3 i.decade i.rlregion   
estimates store m6


esttab m1 m2 m3 m4 m5 m6 using "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\tables\drop_controltable.tex" , replace  style(tex) nogaps compress mtitles label stats(N r2 regionFE decadeFE)


***********************************************
*********  CORRELATION MATRIX *****************
***********************************************

***CORRELATION TABLE
corrtex c1_business_a c2_business_a business_business_a v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 , file("C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\tables\correlationtable2.tex") 


************************************************
***********  PREDICTION ANALYSIS   *************
************************************************

*with business elites
logit cwinit c1_business_a c2_business_a business_business_a c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 , cluster(dyadid)
gen in_model_1 = e(sample)



logit cwinit c1_business_a c2_business_a business_business_a c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3  , cluster(dyadid)
estat classification, cutoff(0.05)
lroc


*Baseline model with no business elites
logit cwinit c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3   , cluster(dyadid) , if in_model_1==1

estat classification, cutoff(0.05)
lroc

*very sparse model
logit cwinit contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3   , cluster(dyadid) , if in_model_1==1
estimates store sparse1
estat classification, cutoff(0.05)
lroc

*very sparse model + business elites
logit cwinit c1_business_a c2_business_a business_business_a contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3   , cluster(dyadid) , if in_model_1==1
estimates store sparse2
estat classification, cutoff(0.05)
lroc



*fixed effects
xtlogit cwinit c1_business_a c2_business_a business_business_a c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 , fe
predict pred_prob2, pu0
logit cwinit pred_prob2
lroc

*fe - no business
xtlogit cwinit c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 , fe
predict pred_prob3, pu0
logit cwinit pred_prob3
lroc


*****************************************

***WWI and WWII

*****************************************


set more off

generate worldwar=.
replace worldwar=0
replace worldwar=1 if (year>1913 & year<1919)
replace worldwar=1 if (year>1939 & year<1946)



*with farris controls
logit cwinit c1_business c2_business business_business c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if worldwar==0, cluster(dyadid)
estimates store m1


*with farris controls + polyarchy and supsize
logit cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if worldwar==0 , cluster(dyadid)
estimates store m2

**with dyad-fixed effects
xtlogit cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 cwpceyrs cwpceyrs2 cwpceyrs3 i.decade if worldwar==0 , fe 
estimates store m3


**with dyad-fixed effects
xtreg cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 cwpceyrs cwpceyrs2 cwpceyrs3 i.decade if worldwar==0 , fe 
estimates store m4

esttab m1 m2 m3 m4  using "C:\Users\torewig_adm\Dropbox\Samarbeid\HVDEM_WAR\tables\worldwar.tex" , replace  style(tex) nogaps compress mtitles label stats(N r2 regionFE decadeFE)



*****************************************

***DEMOCRACY AND DICTATORSHIPS

*****************************************

*Democratic dyads (joint democracy)
logit cwinit c1_business c2_business business_business c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if v2x_polyarchy_min>.26, cluster(dyadid)
estimates store m1 


*Not joint democracy 
logit cwinit c1_business c2_business business_business c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if v2x_polyarchy_min<.26, cluster(dyadid)
estimates store m2

*Democracy vs. autocracy
logit cwinit c1_business c2_business business_business c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if c1_v2x_polyarchy>.26 & c2_v2x_polyarchy<.26, cluster(dyadid)
estimates store m3

*Autocracy vs. democracy
logit cwinit c1_business c2_business business_business c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if c1_v2x_polyarchy<.26 & c2_v2x_polyarchy>.26, cluster(dyadid)
estimates store m4

*Autocracy vs. democracy
logit cwinit c1_business c2_business business_business c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if c1_v2x_polyarchy<.26 & c2_v2x_polyarch<.26, cluster(dyadid)
estimates store m5

esttab m1 m2 m3 m4 m5 using "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\tables\democracy_v2.tex" , replace  style(tex) nogaps compress mtitles label stats(N r2 regionFE decadeFE)


*****************************************

***DEMOCRACY AND DICTATORSHIPS: Initiator

*****************************************

summarize c1_v2x_polyarchy , detail

*****DEMOCRATIC I - DEMOCRATIC J

**with dyad-fixed effects
xtreg cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 cwpceyrs cwpceyrs2 cwpceyrs3 i.decade if c1_v2x_polyarchy>.26 & c2_v2x_polyarchy>.26, fe 
estimates store m2


*****DEMOCRATIC I - AUTOCRATIC J


**with dyad-fixed effects
xtreg cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 cwpceyrs cwpceyrs2 cwpceyrs3 i.decade if c1_v2x_polyarchy>.26 & c2_v2x_polyarchy<.26, fe 
estimates store m4


*****AUTOCRATIC I - AUTOCRATIC J



**with dyad-fixed effects
xtreg cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 cwpceyrs cwpceyrs2 cwpceyrs3 i.decade if c1_v2x_polyarchy<.26 & c2_v2x_polyarchy<.26, fe 
estimates store m6


*****AUTOCRATIC I - DEMOCRATIC J

**with dyad-fixed effects
xtreg cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 cwpceyrs cwpceyrs2 cwpceyrs3 i.decade if c1_v2x_polyarchy<.26 & c2_v2x_polyarchy>.26, fe 
estimates store m8


esttab m2 m4 m6 m8  using "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\tables\democracy3_v2.tex" , replace style(tex) nogaps compress mtitles label stats(N r2 regionFE decadeFE)



*****JOINT NON-DEMOCRACY

*with farris controls + polyarchy and supsize
logit cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if c1_v2x_polyarchy<.26 , cluster(dyadid)
estimates store m3

**with dyad-fixed effects
xtreg cwinit c1_business c2_business business_business v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 cwpceyrs cwpceyrs2 cwpceyrs3 i.decade if c1_v2x_polyarchy<.26, fe 
estimates store m4


esttab m1 m2 m3 m4  using "C:\Users\torewig\Dropbox\Samarbeid\HVDEM_WAR\tables\democracy3.tex" , replace style(tex) nogaps compress mtitles label stats(N r2 regionFE decadeFE)




*****************************************

***FIXED EFFECTS MODELS

*****************************************

**with dyad-fixed effects
xtlogit cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 cwpceyrs cwpceyrs2 cwpceyrs3 i.decade , fe 
estimates store m1


**with dyad-fixed effects
xtreg cwinit c1_business_a c2_business_a business_business_a v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 cwpceyrs cwpceyrs2 cwpceyrs3 i.decade , fe 
estimates store m2

**with dyad-fixed effects
xtlogit cwinit c1_business_r c2_business_r business_business_r v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 cwpceyrs cwpceyrs2 cwpceyrs3 i.decade , fe 
estimates store m3

**with dyad-fixed effects
xtreg cwinit c1_business_r c2_business_r business_business_r v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize  c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 cwpceyrs cwpceyrs2 cwpceyrs3 i.decade , fe 
estimates store m4


esttab m1 m2 m3 m4 using "C:\Users\torewig_adm\Dropbox\Samarbeid\HVDEM_WAR\tables\fixed.tex" , replace  style(tex) nogaps compress mtitles label stats(N r2 regionFE decadeFE)


*****************************************

***MINOR MAJOR POWER

*****************************************

summarize c1_v2x_polyarchy , detail


*major major
logit cwinit c1_business c2_business business_business c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if majpow1==1 & majpow2==1, cluster(dyadid)
estimates store m1

*major minor
logit cwinit c1_business c2_business business_business c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if majpow1==1 & majpow2==0, cluster(dyadid)
estimates store m2

*minor major
logit cwinit c1_business c2_business business_business c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if majpow1==0 & majpow2==1, cluster(dyadid)
estimates store m3

*minor minor
logit cwinit c1_business c2_business business_business c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade if majpow1==0 & majpow2==0, cluster(dyadid)
estimates store m4

esttab m1 m2 m3 m4 using "C:\Users\torewig_adm\Dropbox\Samarbeid\HVDEM_WAR\tables\majmin.tex" , replace  style(tex) nogaps compress mtitles label stats(N r2 regionFE decadeFE)


*****************************************

***OTHER MEASURES OF BUSINESS ELITES

*****************************************


****MODELS WITH THE sliding scale measure

*with farris controls
logit cwinit c1_business c2_business business_business c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m1


*with farris controls + polyarchy and supsize
logit cwinit c1_business c2_business business_business  v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m2


****MODELS WITH THE "most important" measure

*with farris controls
logit cwinit c1_business_imp c2_business_imp business_business_imp c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m3


*with farris controls + polyarchy and supsize
logit cwinit c1_business_imp c2_business_imp business_business_imp v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m4

****MODELS WITH THE "one" measure

*with farris controls
logit cwinit c1_business_one c2_business_one business_business_one c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m5


*with farris controls + polyarchy and supsize
logit cwinit c1_business_one c2_business_one business_business_one v2x_polyarchy_min numgroups1 numgroups2 c1_v2regsupgroupssize c2_v2regsupgroupssize c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m6





esttab m1 m2 m3 m4 m5 m6 using "C:\Users\torewig_adm\Dropbox\Samarbeid\HVDEM_WAR\tables\measures.tex" , replace  style(tex) nogaps compress mtitles label stats(N r2 regionFE decadeFE)






























*TRADE

*controlling for trade
logit cwinit c1_business c2_business business_business c1_s_cow_trade_imports c1_s_cow_trade_exports c2_s_cow_trade_imports c2_s_cow_trade_exports v2x_polyarchy_min c1_s_far_maddisonGDP c2_s_far_maddisonGDP c1_s_far_Maddison_pop_estimate  c2_s_far_Maddison_pop_estimate  cap_1 cap_2 contig ldistance  cwpceyrs cwpceyrs2 cwpceyrs3 i.rlregion i.decade  , cluster(dyadid)
estimates store m15

*split sample on WHAT


*************************************

**COLONIAL WARS

*************************************

clear
use "C:\Users\torewig_adm\Dropbox\Samarbeid\HVDEM_WAR\Data\Monadic.dta"
xtset country_id year

label variable business_imp "Business elites"
label variable extrastate_peaceyears "Peace years"
label variable extrapceyrs2 "Peace years$_{2}$"
label variable extrapceyrs3 "Peace years$_{3}$"
label variable v2x_polyarchy "Democracy (Polyarchy)"
label variable s_far_Maddison_pop_estimate "L(population)"
label variable s_far_Maddison_gdp_1990_estimate "L(GDP)"



*spare model
logit F.extrastate_sidea_onset business_imp extrastate_peaceyears extrapceyrs2 extrapceyrs3 i.decade , cluster(country_id)
estimates store m0

*spare model
logit F.extrastate_sidea_onset business_imp s_far_Maddison_pop_estimate s_far_Maddison_gdp_1990_estimate extrastate_peaceyears extrapceyrs2 extrapceyrs3 i.decade , cluster(country_id)
estimates store m1

*with polyarchy
xtlogit F.extrastate_sidea_onset business_imp s_far_Maddison_pop_estimate s_far_Maddison_gdp_1990_estimate v2x_polyarchy extrastate_peaceyears extrapceyrs2 extrapceyrs3 i.decade , fe
estimates store m2

* pre 1960
logit F.extrastate_sidea_onset business_imp s_far_Maddison_pop_estimate s_far_Maddison_gdp_1990_estimate v2x_polyarchy extrastate_peaceyears extrapceyrs2 extrapceyrs3 i.decade  if year < 1960 , cluster(country_id)
estimates store m3

*post 1960
logit F.extrastate_sidea_onset business_imp s_far_Maddison_pop_estimate s_far_Maddison_gdp_1990_estimate  v2x_polyarchy extrastate_peaceyears extrapceyrs2 extrapceyrs3 i.decade if year > 1960 , cluster(country_id)
estimates store m4

* pre 1939
logit F.extrastate_sidea_onset business_imp s_far_Maddison_pop_estimate s_far_Maddison_gdp_1990_estimate v2x_polyarchy extrastate_peaceyears extrapceyrs2 extrapceyrs3 i.decade  if year < 1939 , cluster(country_id)
estimates store m5

*post 1939
logit F.extrastate_sidea_onset business_imp s_far_Maddison_pop_estimate s_far_Maddison_gdp_1990_estimate  v2x_polyarchy extrastate_peaceyears extrapceyrs2 extrapceyrs3 i.decade if year > 1939 , cluster(country_id)
estimates store m6


*high constraints
logit F.extrastate_sidea_onset business_imp s_far_Maddison_pop_estimate s_far_Maddison_gdp_1990_estimate  v2x_polyarchy extrastate_peaceyears extrapceyrs2 extrapceyrs3 i.decade if v2xlg_legcon > .62 , cluster(country_id)
estimates store m7


esttab  m0 m1 m2 m3 m4 m5 m6 m7 using "C:\Users\torewig_adm\Dropbox\Samarbeid\HVDEM_WAR\tables\tab_colonial2.tex" , replace  style(tex) nogaps compress mtitles label stats(N r2)


